package com.blueocean_health.care.management.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.blueocean_health.care.management.domain.dto.SingleServiceDto;
import com.blueocean_health.care.management.mapper.SingleServiceMapper;
import com.blueocean_health.care.management.service.SingleSerService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
/**
 * 用户端单项  2018年3月9日17:51:54
 * @author wuyanli
 *
 */
@Service
public class SingleSerServiceImpl implements SingleSerService {
	
	@Resource
	private SingleServiceMapper singleDao;
	
	@Value("${service.address}")
	private String serviceAddress;

	/**
	 * 单项 分页查询  2018-3-12 10:36:16
	 */
	@Override
	public PageInfo<SingleServiceDto> getSingleServiceInfo(Map<String,String> map) {
		//默认静态资源城市码设置为 999
		map.put("staticCity", "999");
		int pageSize = Integer.parseInt(map.get("pageSize"));
		int page = Integer.parseInt(map.get("page"));
		PageHelper.startPage(page,pageSize);
		List<SingleServiceDto> singleServiceInfo = singleDao.getSingleServiceInfo(map);
		for (SingleServiceDto singleServiceDto : singleServiceInfo) {
			//拼接静态资源路径
			singleServiceDto.setSinglePic(serviceAddress+singleServiceDto.getSinglePic());
		}
		PageInfo<SingleServiceDto> pageInfo = new PageInfo<SingleServiceDto>(singleServiceInfo);
		return pageInfo;
	}

	
}
